package ch8.zadanie2;

import java.util.Date;

public class Person {

	private String name;
	private String surname;
	private Date data;
	private Car car;

	Person(String name, String surname, Date data, Car car) {
		setName(name);
		setSurname(surname);
		setData(data);
		setCar(car);
	}

	public String getName() {
		return this.name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getSurname() {
		return this.surname;
	}

	public void setSurname(String surname) {
		this.surname = surname;
	}

	public Date getData() {
		return this.data;
	}

	public void setData(Date data) {
		this.data = data;
	}

	public Car getCar() {
		return this.car;
	}

	public void setCar(Car car) {
		this.car = car;
	}

	private Long getAge() {
		Date today = new Date();
		Long seconds = today.getTime() - getData().getTime();
		Long years = (seconds / (1000 * 60 * 60 * 24)) / 365;
		return years;

	}

	public String introduceYou() {
		return "My name is " + name + " " + surname + " and I have " + getAge()
				+ " yers old and My " + car.getMarka() + " has "
				+ car.getCarAge(car) + " year old.";
	}
}
